package com.cuzofu.fs.controller;

import java.util.Arrays;
import java.util.Map;

import com.cuzofu.fs.common.PageUtils;
import com.cuzofu.fs.common.R;
import com.cuzofu.fs.entity.ProjectEntity;
import com.cuzofu.fs.service.ProjectService;
import com.cuzofu.fs.vo.ProjectVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 项目信息
 *
 * @author cuzofu
 * @email cuzofu@qq.com
 * @date 2020-07-10 08:44:49
 */
@RestController
@RequestMapping("/project")
public class ProjectController {
    @Autowired
    private ProjectService projectService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public PageUtils list(@RequestParam Map<String, Object> params) {
        return projectService.queryPage(params);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id) {
        return R.ok().put("data", projectService.queryById(id));
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ProjectEntity project) {
        projectService.save(project);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ProjectEntity project) {
        projectService.updateById(project);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] ids) {
        projectService.deleteProject(ids);

        return R.ok();
    }

}
